package edu.bw.service.impl;

import edu.bw.dao.UserDao;
import edu.bw.service.UserService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
@Data
public class UserServiceImpl03 implements UserService {

    //@Autowired //1.接口只有一个实现类:默认按照类型(可以是自身类型也可以是子类型),这个例子会去找UserDao接口的实现类实例注入,只有一个直接注入
               //2.接口有多个实现类: 首先按照类型匹配=> 有两个实现类=> 由于没有使用@Qualifier=> 会按照bean的id为userDao去查找=> 找到=> 装配
               //                                                                                               => 没找到报错
               //org.springframework.beans.factory.NoUniqueBeanDefinitionException:
               // No qualifying bean of type 'edu.bw.dao.UserDao' available: expected single matching bean but found 2:
               // userDaoImpl02,userDaoImpl
    //private UserDao userDao;


    //@Autowired
    //@Qualifier("userDaoImpl02")
    //private UserDao userDao;
}
